package com.ces.knacky.model;

import java.io.Serializable;
import java.util.Date;
import java.util.Set;

import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;

import com.ces.knacky.framework.model.AbstractMasterEntity;

/** @author Hibernate CodeGenerator */
@XmlRootElement
public class Auction extends AbstractMasterEntity implements Serializable {

    /** nullable persistent field */
    private String summary;

    /** persistent field */
    private String startTime;

    /** persistent field */
    private String endTime;

    /** nullable persistent field */
    private Date startDate;

    /** nullable persistent field */
    private Date endDate;

    /** persistent field */
    private Set<AuctionItem> auctionItems;

    /** persistent field */
    private Set bids;
    
    /** persistent field */
    private AuctionStatus auctionStatus;   

	/** full constructor */
    public Auction(String description, String summary, String startTime, String endTime, 
    Date startDate, Date endDate, Date createTime, Date updateTime, com.ces.knacky.model.Flag
    flag, com.ces.knacky.model.UserTable user, Set<AuctionItem> auctionItems, Set bids,AuctionStatus
    auctionstatus) {
        this.description = description;
        this.summary = summary;
        this.startTime = startTime;
        this.endTime = endTime;
        this.startDate = startDate;
        this.endDate = endDate;
        this.createTime = createTime;
        this.updateTime = updateTime;
        this.flag = flag;
        this.user = user;
        this.auctionItems = auctionItems;
        this.bids = bids;
        this.auctionStatus = auctionstatus;
    }

    /** default constructor */
    public Auction() {
    }

    /** minimal constructor */
    public Auction(String description, String startTime, String endTime, com.ces.knacky.model.
    Flag flag, com.ces.knacky.model.UserTable user, Set<AuctionItem> auctionItems, Set bids,
    AuctionStatus auctionStatus) {
        this.description = description;
        this.startTime = startTime;
        this.endTime = endTime;
        this.flag = flag;
        this.user = user;
        this.auctionItems = auctionItems;
        this.bids = bids;
        this.auctionStatus = auctionStatus;
    }
  
    public String getSummary() {
        return this.summary;
    }

    public void setSummary(String summary) {
        this.summary = summary;
    }

    public String getStartTime() {
        return this.startTime;
    }

    public void setStartTime(String startTime) {
        this.startTime = startTime;
    }

    public String getEndTime() {
        return this.endTime;
    }

    public void setEndTime(String endTime) {
        this.endTime = endTime;
    }

    public Date getStartDate() {
        return this.startDate;
    }

    public void setStartDate(Date startDate) {
        this.startDate = startDate;
    }

    public Date getEndDate() {
        return this.endDate;
    }

    public void setEndDate(Date endDate) {
        this.endDate = endDate;
    }

    @XmlTransient
    public Set<AuctionItem> getAuctionItems() {
        return this.auctionItems;
    }

    public void setAuctionItems(Set<AuctionItem> auctionItems) {
        this.auctionItems = auctionItems;
    }

    @XmlTransient
    public Set getBids() {
        return this.bids;
    }

    public void setBids(Set bids) {
        this.bids = bids;
    }    
  
	public AuctionStatus getAuctionStatus() {
		return auctionStatus;
	}

	public void setAuctionStatus(AuctionStatus auctionStatus) {
		this.auctionStatus = auctionStatus;
	}


    public boolean equals(Object other) {
        if ( !(other instanceof Auction) ) return false;
        Auction castOther = (Auction) other;
        return new EqualsBuilder()
            .append(this.getId(), castOther.getId())
            .isEquals();
    }

}
